package annotations;


import java.lang.reflect.Field;

import annotations.AnnotationClass.AnnotationIFace;
import annotations.AnnotationClass.Required;

public class AnnotationTest {

   public void readAnnotationOne() throws Exception {
       AnnotationClass impl = new AnnotationClass();
       Class<?> implCl      = impl.getClass();
       Field field          = implCl.getDeclaredField("feld1");
       AnnotationIFace anno = field.getAnnotation(AnnotationIFace.class);
       
       System.out.println(anno.value());
       
       Required req = field.getAnnotation(Required.class);
       System.out.println("required: ->> "+req);
//       assertEquals("str1", anno.test());
   }
   
   public void readAnnotationTwo() throws Exception {
       AnnotationClass impl = new AnnotationClass();
       Class<?> implCl      = impl.getClass();
       Field field          = implCl.getDeclaredField("feld2");
       AnnotationIFace anno = field.getAnnotation(AnnotationIFace.class);
       System.out.println(anno);
//       assertEquals("huhu", anno.test());
   }
   
   
   
   public static void main(String[] args) throws Exception {
	   AnnotationTest annoTest = new AnnotationTest();
	   annoTest.readAnnotationOne();
	   annoTest.readAnnotationTwo();
   }
   
  

}

